package u.can.i.up.nist;

import java.io.File;
import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class STSMain {

	static Logger logger = LogManager.getLogger();
	
	public static void main(String[] args) {
		logger.warn("MD5" + "\t" + "s_ApproximateEntropy" + "\t" + "f_ApproximateEntropy"
				+ "\t" + "ratio_ApproximateEntropy"
				+ "\t" + "s_CumulativeSums" + "\t" + "f_CumulativeSums"
				+ "\t" + "ratio_CumulativeSums"
				+ "\t" + "s_LongestRun" + "\t" + "f_LongestRun"
				+ "\t" + "ratio_LongestRun"
				+ "\t" + "s_Rank" + "\t" + "f_Rank"
				+ "\t" + "ratio_Rank"
				+ "\t" + "s_Serial" + "\t" + "f_Serial"
				+ "\t" + "ratio_Serial"
				);
//		String filePath = "/Users/lczgywzyy/Desktop/sts-2.1.1/apk/picked_20160409wandoujia/f28a441bfc098328f3b0f0a11778ee3a.apk";
		String folderPath = "/Users/lczgywzyy/Desktop/sts-2.1.1/apk/picked_20160409wandoujia";
		List<File> fileList = FileUtils.getFileList(folderPath);
		logger.info(fileList.size());
		for(int i = 0; i < fileList.size(); i++){
			String filePath = fileList.get(i).getAbsolutePath();
			logger.info("Target Apk[" + (i + 1 ) + "/" + fileList.size()+ "]:" + filePath);
			String MD5 = filePath.substring(filePath.lastIndexOf("/") + 1, filePath.indexOf(".apk"));
			Core.getInstance().run(filePath);
			Core.getInstance().restoreResults(MD5);
			Core.getInstance().calculateResults(MD5);
		}

		
	}

}
